package com.netease.nie.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.netease.nie.common.CommonService;
import com.netease.nie.dao.DrawLotteryParticipationRecordDao;
import com.netease.nie.model.DrawLotteryParticipationRecord;

/**
 * 抽奖记录业务服务接口实现
 * @author gzlibingjie
 */
@Service
public class DrawLotteryParticipationRecordServiceImpl extends CommonService implements DrawLotteryParticipationRecordService {

	@Resource
	private DrawLotteryParticipationRecordDao drawLotteryParticipationRecordDao;
	
	/**
	 * 插入一条抽奖记录
	 * @param drawLotteryParticipationRecord 要保存的抽奖记录
	 * @return 影响的行数
	 */
	@Override
	public int insert(DrawLotteryParticipationRecord drawLotteryParticipationRecord) {
		return drawLotteryParticipationRecordDao.insert(drawLotteryParticipationRecord);
	}

	/**
	 * 获取近N次抽奖记录
	 * @param userId 用户ID
	 * @param drawLotteryActivityId 抽奖活动ID
	 * @param minimumTimes 近N次
	 * @return 抽奖记录列表
	 */
	@Override
	public List<DrawLotteryParticipationRecord> queryLast(Long userId, Integer drawLotteryActivityId, Integer minimumTimes) {
		return drawLotteryParticipationRecordDao.queryLast(userId, drawLotteryActivityId, minimumTimes);
	}

}
